﻿using UnityEngine;
using System.Collections;
using UniLua;

namespace TCG.FFI
{
	public static class UnityShaderLib
	{
		public static string LIB_NAME = "UnityShaderLib";

		public static string ParentLibName = "UnityObjectLib";

		public static int lf_Find (ILuaState luaState)
		{
			string name = luaState.ToString (1);
			Shader shader = Shader.Find (name);
			if (shader == null)
			{
				luaState.PushNil ();
			}
			else
			{
				LuaTools.L_PushUserData (luaState, shader, LIB_NAME);
			}
			return 1;
		}

		public static int lf_WarmupAllShaders (ILuaState luaState)
		{
			Shader.WarmupAllShaders ();
			return 0;
		}
	}
}